package com.edu.controller.controller;

import com.edu.controller.model.User;
import com.edu.controller.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

@RestController
@RequestMapping("/demo")
public class DemoController {
    @Autowired
    private UserServiceImpl userService;

    @RequestMapping("/test")
    public ModelAndView test(){
        User u = userService.findUserById(1l);
        ModelAndView mvc = new ModelAndView("hello");
        mvc.addObject("user",u);
        System.out.println("1122222");
        return mvc;
    }

    @RequestMapping("/test1")
    public String test1(){

        return "hello world";
    }



}
